import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 知识图谱管理信息 */
export interface Knowledge {
  id: number // 编号
  name?: string // 知识图谱名称
  description: string // 描述
  sort?: number // 排序
  status?: number // 状态
}

// 知识图谱管理 API
export const KnowledgeApi = {
  // 查询知识图谱管理分页
  getKnowledgePage: async (params: any) => {
    return await request.get({ url: `/school/knowledge/page`, params })
  },

  // 查询知识图谱管理详情
  getKnowledge: async (id: number) => {
    return await request.get({ url: `/school/knowledge/get?id=` + id })
  },
  // 获得知识图谱tree节点信息
  getKnowledgeNodeTree: async (knowledgeId: number) => {
    return await request.get({ url: `/school/knowledge/node-info?knowledgeId=` + knowledgeId })
  },
  // 新增知识图谱管理
  createKnowledge: async (data: Knowledge) => {
    return await request.post({ url: `/school/knowledge/create`, data })
  },

  // 修改知识图谱管理
  updateKnowledge: async (data: Knowledge) => {
    return await request.put({ url: `/school/knowledge/update`, data })
  },

  // 删除知识图谱管理
  deleteKnowledge: async (id: number) => {
    return await request.delete({ url: `/school/knowledge/delete?id=` + id })
  },

  /** 批量删除知识图谱管理 */
  deleteKnowledgeList: async (ids: number[]) => {
    return await request.delete({ url: `/school/knowledge/delete-list?ids=${ids.join(',')}` })
  },

  // 导出知识图谱管理 Excel
  exportKnowledge: async (params) => {
    return await request.download({ url: `/school/knowledge/export-excel`, params })
  }
}
